package org.darkforest.common.services.impl;

import org.darkforest.common.services.GiftDistributionService;
import org.darkforest.dao.mapper.GiftDistributionMapper;
import org.darkforest.model.GiftDistribution;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by pc on 2017/4/7.
 */
@Service
public class GiftDistributionServiceImpl implements GiftDistributionService {
    @Autowired
    private GiftDistributionMapper giftDistributionMapper;
    @Override
    public GiftDistribution selectByCondition(GiftDistribution record) {
        record.setResultList(giftDistributionMapper.selectByCondition(record));
        return record;
    }

    /**
     * 根据多个id 批量查询 1,2,3,4
     *
     * @param ids
     * @return
     */
    @Override
    public List<GiftDistribution> selectListByIds(String ids) {
        List<String> idList =  Arrays.asList(ids.split(","));
        return giftDistributionMapper.selectListByIds(idList);
    }
}
